Skip to content

SERVER-123310 Remove nsToDatabase() in favor of nsToDatabaseSubstring()#1817

Open
EdanStasiuk wants to merge 1 commit into
mongodb:masterfrom
EdanStasiuk:SERVER-123310-make-nsToDatabase-return-StringData-instead-of-std-string
Open

SERVER-123310 Remove nsToDatabase() in favor of nsToDatabaseSubstring()#1817
EdanStasiuk wants to merge 1 commit into
mongodb:masterfrom
EdanStasiuk:SERVER-123310-make-nsToDatabase-return-StringData-instead-of-std-string

Conversation

@EdanStasiuk

Copy link
Copy Markdown

Summary

Fixes SERVER-123310

nsToDatabase() was a thin wrapper around nsToDatabaseSubstring() that returned std::string, causing an unnecessary string copy. Rather than changing the return type to StringData (as the TODO requested), the function was removed entirely since it was identical in behavior to nsToDatabaseSubstring(). All callers already used nsToDatabaseSubstring() directly, so no call sites needed updating.

@EdanStasiuk EdanStasiuk force-pushed the SERVER-123310-make-nsToDatabase-return-StringData-instead-of-std-string branch from 5aa0040 to 2bfc1c2 Compare May 30, 2026 19:27
@EdanStasiuk

Copy link
Copy Markdown
Author

Happy to revert to just changing the return type to StringData if you'd prefer to keep nsToDatabase() around, just let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant